Fix instrument edit history vZoom/vScroll issue #2139
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Medium-ish severity (you lose your current undo/redo history when trying to undo past opening a previously unopened macro tab).
Description
Previously, when opening a previously unopened macro tab, all vZoom/vScroll values would automatically get reset from their initial -1 to reasonable values, leading to an undo state being created, which clears redo history. If you would try to undo this, it would revert to -1, leading their values to get reset again, creating an undo step again -- so effectively, opening a previously unopened macro tab cleared your redo history and you could not undo beyond it.
For the fix, my thinking was that vZoom/vScroll should get set up when the instrument is created, rather than remaining -1 until tab opened, so that all these spurious data changes don't happen at all. To get the proper starting values we need data that insEdit previously set up by building a "macroList" of FurnaceGUIMacroDesc in various spots in the code. So the bulk of the refactor is pulling out building the macroList into isolated functions, so that they can be called as part of initializing vZoom/vScroll.
Caveats
Would be very open to ideas for simpler ways to address the issue!
(When testing/messing with with instrument edit undo, please use the history table provided in the Help->Debug window, it shows patch info for the undo/redo queues.)